package com.lxq.test1912.Main01;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int n,k=0,num=0;
        String s;
        int[] time = {0,0,0,0};
        Scanner sc = new Scanner(System.in);

        n=sc.nextInt();

        for (int i=0;i<n;k++){
            boolean Jump=false;//跳过：true
            num++;
            s = num+"";
            //1.1判断是否有7
//            if (s.matches(".*(7+).*")){
//                Jump = true;
//                break;
//            }
            for (int tag=0;tag<s.length();tag++){
                if (s.charAt(tag)=='7') {
                    Jump = true;
                    break;
                }
            }
            //1.2判断是否是7的倍数
            if (num%7==0) Jump=true;

            //1.3
            if (Jump){
                time[k%4]++;
            }else{
                i++;//没跳过，消耗一个数
            }


        }

        for (int a:time
             ) {
            System.out.println(a);
        }
    }
}
